import { createApp } from 'vue'
import App from './App.vue'
import router from './router/router'
import pinia from './store'
import useElementPlusIcons from './utils/use-element-plus-icons'
import '@/assets/global.css'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'

import './views/user/util/color/styles/theme.css'




// Make App Instance
const app = createApp(App)

// Use Router
app.use(router)

// Use Element Plus
app.use(ElementPlus)

// Use Element Plus
useElementPlusIcons(app)


// Use Pinia
app.use(pinia)

// 进入网站时设置标记
localStorage.setItem('isOnSite', 'true');

// 监听页面卸载
window.addEventListener('beforeunload', (event) => {
  // 判断是否是刷新
  const navType = performance.getEntriesByType('navigation')[0]?.type;
  if (navType !== 'reload') {
    // 不是刷新，清空存储
    localStorage.clear();
    sessionStorage.clear();
  }
});

app.mount('#app')
